package com.shrct.businessprocess.organization.impl;

import com.shrct.businessprocess.organization.RCEnterprise;
import com.shrct.businessprocess.organization.RCEnterpriseDAO;
import edu.fudan.mylang.pf.BaseDAOService;
import edu.fudan.mylang.pf.IGenericQuery;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.springframework.stereotype.Service;

@Service("com.shrct.businessprocess.organization.RCEnterpriseDAO")
public class RCEnterpriseDAOImpl extends BaseDAOService<RCEnterprise> implements RCEnterpriseDAO {
  public RCEnterprise findByExactName(final String name) {
    IGenericQuery<RCEnterprise> query=getObjectFactory().createGenericQuery(RCEnterprise.class,"select e from com.shrct.businessprocess.organization.impl.RCEnterpriseImpl as e   where ((e.name) = (:name)) and  e.active = 1      ").setParameter("name",name);
    Collection<RCEnterprise> _list = query.list();
    RCEnterprise _head = IterableExtensions.<RCEnterprise>head(_list);
    return _head;
  }
  
  public RCEnterprise findByExactCode(final String code) {
    IGenericQuery<RCEnterprise> query=getObjectFactory().createGenericQuery(RCEnterprise.class,"select e from com.shrct.businessprocess.organization.impl.RCEnterpriseImpl as e   where ((e.code) = (:code)) and  e.active = 1      ").setParameter("code",code);
    Collection<RCEnterprise> _list = query.list();
    RCEnterprise _head = IterableExtensions.<RCEnterprise>head(_list);
    return _head;
  }
}
